package com.first.system.controller;

import com.first.common.pojo.TbBottomArticle;
import com.first.common.vo.Result;
import com.first.system.service.BottomService;
import com.first.system.vo.BottomVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: first-project
 * @description:
 * @author: 闫锦超
 * @create: 2023-05-26 18:23
 **/
@RestController
@RequestMapping("/home/bottomarticle")
@Api(tags = "底部文章")
public class BottomController {
    @Autowired
    private BottomService bottomService;
    @PostMapping("/getAllBottomArticle/{currentPage}/{pageSize}")
    @ApiOperation(value = "获取所有的底部文章")
    public Result getAllBottomArticle(@PathVariable Integer currentPage, @PathVariable Integer pageSize, @RequestBody BottomVo bottomVo){
            return bottomService.getAllBottomArticle(currentPage,pageSize,bottomVo);
    }

    @PostMapping("/changeStatus/{id}/{isDisable}")
    @ApiOperation(value = "修改底部文章分类状态")
    public Result changeStatus(@PathVariable String id,@PathVariable Integer isDisable){
        return bottomService.changeStatus(id,isDisable);
    }

    @PostMapping("/deleteBottomArticle")
    @ApiOperation(value = "删除底部文章")
    public Result deleteBottomArticle(@RequestBody TbBottomArticle bottomArticle){
        return bottomService.deleteBottomArticle(bottomArticle);
    }

    @PostMapping("/addBottomArticle")
    @ApiOperation(value = "增加底部文章")
    public Result addBottomArticle(@RequestBody TbBottomArticle tbBottomArticle){
        return bottomService.addBottomArticle(tbBottomArticle);
    }

    @PostMapping("/editBottomArticle")
    @ApiOperation(value = "修改底部文章")
    public Result editBottomArticle(@RequestBody TbBottomArticle tbBottomArticle){
        return bottomService.editBottomArticle(tbBottomArticle);
    }
}
